package com.jzo2o.foundations.controller.consumer;

import com.jzo2o.foundations.model.domain.ServeAggregation;
import com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO;
import com.jzo2o.foundations.service.ServeAggregationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 国兴越
 * @version 1.0
 * Create by
 */
@RestController("consumerServeController")
@RequestMapping("/customer/serve")
@Api(tags = "用户端-首页服务查询接口")
public class FirstPageServeController {


    @Resource
    private ServeAggregationService serveAggregationService;



    @GetMapping("search")
    @ApiOperation("首页服务搜索")
    @ApiImplicitParams({

        @ApiImplicitParam(name = "cityCode",value = "城市编码",dataTypeClass = String.class),
      @ApiImplicitParam(name = "serveTypeId", value = "服务类型id", dataTypeClass = Long.class),
         @ApiImplicitParam(name = "keyword", value = "关键词", dataTypeClass = String.class)
    })
    public List<ServeSimpleResDTO> findServeList(@RequestParam("cityCode")String cityCode,
                                                 @RequestParam("serveTypeId") Long serveTypeId,
                                                 @RequestParam("keyword") String keyword){



   List<ServeSimpleResDTO> serveList =  serveAggregationService.findServeList(cityCode,serveTypeId,keyword);

   return serveList;

    }









}
